package echat.future.cn.echat.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.nostra13.universalimageloader.core.ImageLoader;

import echat.future.cn.echat.R;
import lumingweihua.future.cn.baselibgxh.network.AbstractRequest;
import lumingweihua.future.cn.baselibgxh.network.ReqTag;
import lumingweihua.future.cn.baselibgxh.network.entity.MamaHaoServerError;
import lumingweihua.future.cn.baselibgxh.utils.ImageUtils;

/**
 * @描述 是否选择通用框
 * @Copyright Copyright (c) 2016
 * @version 1.0
 */
public class YuyueTipDialog extends Dialog implements OnClickListener,AbstractRequest.ApiCallBack {
    private OnYuyueTipDialogClickListener listener;
    public YuyueTipDialog(Context context, String image,
                          OnYuyueTipDialogClickListener listener) {
        super(context, R.style.BMF_Dialog);
        this.listener = listener;
        setCanceledOnTouchOutside(true);
        setContentView(R.layout.yuyue_tip_dialog);
        ImageLoader.getInstance().displayImage(image, (ImageView) findViewById(R.id.iv_head), ImageUtils.imgOptionsHead);
        findViewById(R.id.bt_yes).setOnClickListener(this);
        findViewById(R.id.iv_close).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {

        if (v.getId()==R.id.bt_yes){
            dismiss();
            if (listener != null) {
                listener.onYesClick();
            }
        }if (v.getId()==R.id.iv_close){
            dismiss();
        }
    }

    @Override
    public void onApiOnSuccess(ReqTag tag, Object data) {

    }

    @Override
    public void onApiFailure(ReqTag tag, MamaHaoServerError error, AbstractRequest.MamaHaoError clientError) {

    }

    public interface OnYuyueTipDialogClickListener {
        void onYesClick();
    }

}
